import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:xiaomi_demo/src/modules/web/controllers/web_controller.dart';
import 'package:xiaomi_demo/src/services/app_colors.dart';

class WebView extends GetView<WebController> {
  const WebView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text(''),
          centerTitle: true,
          backgroundColor: Colors.white,
          elevation: 0,
        ),
        body: _body());
  }

  Widget _body() {
    return Obx(() => controller.isLoadFinished.value
        ? WebViewWidget(controller: controller.webVC)
        : LinearProgressIndicator(
            backgroundColor: DoColors.theme.withOpacity(0.3),
            color: DoColors.theme,
          ));
  }
}
